FROM openjdk:17.0.2-oraclelinux8 as builder
WORKDIR .
ARG JAR_FILE=target/*execute.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract

FROM openjdk:17.0.2-oraclelinux8
WORKDIR .
COPY --from=builder ./dependencies/ ./
COPY --from=builder ./spring-boot-loader/ ./
COPY --from=builder ./snapshot-dependencies/ ./
COPY --from=builder ./application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
